import allure
from selenium.webdriver.common.by import By
from psa.BasePage import BasePage


class LoginPage(BasePage):

    @allure.step("禅道账号登录")
    def login_success(self, username, password):
        self.input_text((By.XPATH, "//input[@name='account']"), username, name="输入账号")
        self.input_text((By.XPATH, "//input[@name='password']"), password, name="输入密码")
        self.click_element((By.XPATH, "//button[@id='submit']"), name="点击登录按钮")
        self.wait_element((By.XPATH, "//*[contains(text(),'地盘')] "), timeout=10, name="等待页面显示地盘")
        self.sleep(3)